<?php
if (!defined ('TYPO3_MODE')) 	die ('Access denied.');

$TCA['tx_filelinks'] = array (
	'ctrl' => $TCA['tx_filelinks']['ctrl'],
	'interface' => array (
		'showRecordFieldList' => 'hidden,link_type,link_page,link_file,link_url,link_mail,label,description,thumb,fileinfo,secure,forcedl'
	),
	'feInterface' => $TCA['tx_filelinks']['feInterface'],
	'columns' => array (
		'hidden' => array (		
			'exclude' => 1,
			'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
			'config'  => array (
				'type'    => 'check',
				'default' => '0'
			)
		),
        'link_type' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.link_type',
            'config' => array (
                'type' => 'select',
                'items' => array(
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.typeOption0', 0),
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.typeOption1', 1), // Page
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.typeOption2', 2), // File
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.typeOption3', 3), // External
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.typeOption4', 4), // E-Mail
                ),
                'onChange' => 'reload'
            ),
        ),
        'link_page' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.link_page',
            'config' => array (
				'type'     => 'input',
				'size'     => '46',
				'max'      => '255',
				'checkbox' => '',
				'eval'     => 'required,trim',
				'wizards'  => array(
					'_PADDING' => 2,
					'link'     => array(
						'type'         => 'popup',
						'title'        => 'Link',
						'icon'         => 'link_popup.gif',
						'script'       => 'browse_links.php?mode=wizard',
						'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        'params' => array(
                            'blindLinkOptions' => 'file,folder,spec,url,mail'
                        )
					)
				)
            ),
            'displayCond' => 'FIELD:link_type:=:1',
        ),
        'link_file' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.link_file',
            'config' => array (
				'type'     => 'input',
				'size'     => '46',
				'max'      => '255',
				'checkbox' => '',
				'eval'     => 'required,trim',
				'wizards'  => array(
					'_PADDING' => 2,
					'link'     => array(
						'type'         => 'popup',
						'title'        => 'Link',
						'icon'         => 'link_popup.gif',
						'script'       => 'browse_links.php?mode=wizard',
						'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        'params' => array(
                            'blindLinkOptions' => 'page,folder,spec,url,mail'
                        )
					)
				)
            ),
            'displayCond' => 'FIELD:link_type:=:2',
        ),
        'link_url' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.link_url',
            'config' => array (
				'type'     => 'input',
				'size'     => '46',
				'max'      => '255',
				'checkbox' => '',
				'eval'     => 'required,trim',
				'wizards'  => array(
					'_PADDING' => 2,
					'link'     => array(
						'type'         => 'popup',
						'title'        => 'Link',
						'icon'         => 'link_popup.gif',
						'script'       => 'browse_links.php?mode=wizard',
						'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        'params' => array(
                            'blindLinkOptions' => 'page,file,folder,spec,mail'
                        )
					)
				)
            ),
            'displayCond' => 'FIELD:link_type:=:3',
        ),
        'link_mail' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.link_mail',
            'config' => array (
				'type'     => 'input',
				'size'     => '46',
				'max'      => '255',
				'checkbox' => '',
				'eval'     => 'required,trim',
				'wizards'  => array(
					'_PADDING' => 2,
					'link'     => array(
						'type'         => 'popup',
						'title'        => 'Link',
						'icon'         => 'link_popup.gif',
						'script'       => 'browse_links.php?mode=wizard',
						'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        'params' => array(
                            'blindLinkOptions' => 'page,file,folder,spec,url'
                        )
					)
				)
            ),
            'displayCond' => 'FIELD:link_type:=:4',
        ),
        'label' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.label',
            'config' => array (
                'type' => 'input',
                'size' => '48',
                'eval' => 'trim'
            ),
            'displayCond' => 'FIELD:link_type:>:0',
        ),
        'thumb' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.thumbnail',
            'config' => array (
                'type' => 'group',
                'internal_type' => 'file',
                'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
                'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
                'uploadfolder' => 'uploads/tx_filelinks',
                'show_thumbs' => 1,
                'size' => 1,
                'minitems' => 0,
                'maxitems' => 1,
                'selectedListStyle' => 'width:200px;height:1.7em'
            ),
            'displayCond' => 'FIELD:link_type:>:0',
        ),
        'description' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.description',
            'config' => array (
                'type' => 'text',
                'cols' => '48',
                'rows' => '3'
            ),
            'displayCond' => 'FIELD:link_type:>:0',
        ),
        'fileinfo' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.fileinfo',
            'config' => array (
                'type' => 'select',
                'items' => array(
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option0', -1),
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option1', 0),
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option2', 1),
                )
            ),
            'displayCond' => 'FIELD:link_type:=:2',
        ),
        'secure' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.secure',
            'config' => array (
                'type' => 'select',
                'items' => array(
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option0', -1),
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option1', 0),
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option2', 1),
                )
            ),
            'displayCond' => 'FIELD:link_type:=:2',
        ),
        'forcedl' => array (
            'exclude' => 0,
            'label' => 'LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.forcedownload',
            'config' => array (
                'type' => 'select',
                'items' => array(
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option0', -1),
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option1', 0),
                    array('LLL:EXT:filelinks/locallang_db.xml:tx_filelinks.option2', 1),
                )
            ),
            'displayCond' => 'FIELD:link_type:=:2',
        ),
        'parentid' => array (
            'config' => array (
                'type' => 'passthrough',
            ),
        ),
        'parenttable' => array (
            'config' => array (
                'type' => 'passthrough',
            ),
        ),
	),
	'types' => array (
		'0' => array('showitem' => 'hidden;;1;;1-1-1,link_type,link_page,link_file,link_url,link_mail,label,description,thumb,fileinfo,secure,forcedl')
	),
	'palettes' => array (
		'1' => array('showitem' => '')
	)
);
?>